<?php
use kartik\datecontrol\Module;
return [
    'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
    'extensions' => require(__DIR__ . '/../../vendor/yiisoft/extensions.php'),
    'components' => [
	    'user' => [
			'class' => 'yii\web\User',
		    'identityClass' => 'common\models\User',
		    'enableAutoLogin' => true,
	    ],
	    'authManager' => [
	    	'class' => 'base\AuthManager',
	    ],
      'urlManager' => [
                'enablePrettyUrl' => true,
                'showScriptName' => false,
            ],
        'cache' => [
            'class' => 'yii\caching\FileCache',
        ],
    ],
	'modules' => [
    'gridview' =>  [
     'class' => '\kartik\grid\Module'
     // enter optional module parameters below - only if you need to
     // use your own export download action or custom translation
     // message source
     // 'downloadAction' => 'gridview/export/download',
     // 'i18n' => []
 ],
		'datecontrol' =>  [
			'class' => '\kartik\datecontrol\Module',

			// format settings for displaying each date attribute (ICU format example)
		    'displaySettings' => [
		        Module::FORMAT_DATE => 'dd-MM-yyyy',
		        Module::FORMAT_TIME => 'hh:mm:ss a',
		        Module::FORMAT_DATETIME => 'dd-MM-yyyy hh:mm:ss a',
		    ],

		    // format settings for saving each date attribute (PHP format example)
		    'saveSettings' => [
		        Module::FORMAT_DATE => 'php:U', // saves as unix timestamp
		        Module::FORMAT_TIME => 'php:H:i:s',
		        Module::FORMAT_DATETIME => 'php:U',
		    ],

			// set your display timezone
			'displayTimezone' => 'Asia/Shanghai',

			// set your timezone for date saved to db
			'saveTimezone' => 'UTC',

			// automatically use kartik\widgets for each of the above formats
			// 'autoWidget' => true,

			// default settings for each widget from kartik\widgets used when autoWidget is true
//			'autoWidgetSettings' => [
//				Module::FORMAT_DATE => ['type'=>2, 'pluginOptions'=>['autoclose'=>true]], // example
//				Module::FORMAT_DATETIME => [], // setup if needed
//				Module::FORMAT_TIME => [], // setup if needed
//			],

			// custom widget settings that will be used to render the date input instead of kartik\widgets,
			// this will be used when autoWidget is set to false at module or widget level.
//			'widgetSettings' => [
//				Module::FORMAT_DATE => [
//					'class' => 'yii\jui\DatePicker', // example
//					'options' => [
//						'dateFormat' => 'php:d-M-Y',
//						'options' => ['class'=>'form-control'],
//					]
//				]
//			]
			// other settings
		]
	],
	'params' => [
		// format settings for displaying each date attribute (ICU format example)
		'dateControlDisplay' => [
			Module::FORMAT_DATE => 'Y-m-d H:i:s',
			Module::FORMAT_TIME => 'hh:mm:ss a',
			Module::FORMAT_DATETIME => 'dd-MM-yyyy hh:mm:ss a',
		],

		// format settings for saving each date attribute (PHP format example)
//		'dateControlSave' => [
//			Module::FORMAT_DATE => 'php:U', // saves as unix timestamp
//			Module::FORMAT_TIME => 'php:H:i:s',
//			Module::FORMAT_DATETIME => 'php:Y-m-d H:i:s',
//		]
	],
];
